﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Scripts.LDS
{
    struct SelRelationship
    {
        public int id;
        public string nameString;
        public string entityString;
    };

    struct SelAttribute
    {
        public int id;
        public string nameString;
    };

    class SelCommand
    {
        
        public int id;
        public string verbString;
        public bool isApplied = false;

        public int attributeCount = 0;
        public List<string> attributeStrings = new List<string>();

        public int targetCount = 0;
        public List<string> targetStrings = new List<string>();

        public SelCommand() { }

        public SelCommand(SelCommand sel)
        {
            id = sel.id;
            verbString = sel.verbString;
            isApplied = sel.isApplied;

            attributeCount = sel.attributeCount;
            targetCount = sel.targetCount;

            attributeStrings = new List<string>(sel.attributeStrings);
            targetStrings = new List<string>(sel.targetStrings);
        }
    };

    class SelEntity
    {
        //SelEntity() : attributeCount(0), relationshipCount(0) { };

        public int id;
        public string nameString;  // e.g. chair-4

        public bool isPlural;
        public string instanceCountString; // could be a number, or string e.g., many some
        public int instanceCount;

        public int attributeCount = 0;
        public int relationshipCount = 0;

        public List<SelRelationship> m_relationships = new List<SelRelationship>();
        public List<SelAttribute> m_attributes = new List<SelAttribute>();

        public string m_determiner;  // empty, a or the

        public List<int> m_instanceNodeIds = new List<int>();  // the node id of current instance

        public SelEntity() { }
        public SelEntity(SelEntity sel)
        {
            id = sel.id;
            nameString = sel.nameString;// e.g. chair-4

            isPlural = sel.isPlural;
            instanceCountString = sel.instanceCountString; // could be a number, or string e.g., many some
            instanceCount = sel.instanceCount;

            attributeCount = sel.attributeCount;
            relationshipCount = sel.relationshipCount;

            m_relationships = new List<SelRelationship>(sel.m_relationships);
            m_attributes = new List<SelAttribute>(sel.m_attributes);

            m_determiner = sel.m_determiner;  // empty, a or the

            m_instanceNodeIds = new List<int>(sel.m_instanceNodeIds);  // the node id of current instance
        }
    };

    class SelSentence
    {

        public int id;
        public string textString;
        public bool isCommand;
        public int entityCount;
        public int commandCount;
        public List<SelEntity> m_entities = new List<SelEntity>();
        public List<SelCommand> m_commands = new List<SelCommand>();

        public SelSentence() { }
        public SelSentence(SelSentence sel)
        {
            id = sel.id;
            textString = sel.textString;
            isCommand = sel.isCommand;
            entityCount = sel.entityCount;
            commandCount = sel.commandCount;


            List<SelEntity> m_entities = new List<SelEntity>();
            foreach (SelEntity se in sel.m_entities)
            {
                m_entities.Add(new SelEntity(se));
            }

            List<SelCommand> m_commands = new List<SelCommand>();
            foreach (SelCommand sm in sel.m_commands)
            {
                m_commands.Add(new SelCommand(sm));
            }
        }
    };

}
